import request from '@/utils/request'

// 添加题目集
export function addQuestionSet(data) {
  return request({
    url: '/api/questionSet',
    method: 'post',
    data
  })
}

// 删除题目集
export function deleteQuestionSet(id) {
  return request({
    url: `/api/questionSet/${id}`,
    method: 'delete'
  })
}

// 修改题目集
export function updateQuestionSet(data) {
  return request({
    url: '/api/questionSet',
    method: 'put',
    data
  })
}

// 根据职位分页查询题目集
export function pageByPosition(pageNum, pageSize, positionId) {
  return request({
    url: `/api/questionSet/page/position/${positionId}`,
    method: 'get',
    params: {
      pageNum,
      pageSize
    }
  })
}

// 根据职位级别分页查询题目集
export function pageByPositionLevel(pageNum, pageSize, level) {
  return request({
    url: '/api/questionSet/page/positionLevel',
    method: 'get',
    params: {
      pageNum,
      pageSize,
      level
    }
  })
}

// 根据状态分页查询题目集
export function pageByStatus(pageNum, pageSize, status) {
  return request({
    url: `/api/questionSet/page/status/${status}`,
    method: 'get',
    params: {
      pageNum,
      pageSize
    }
  })
}

// 查询职位信息
export function queryPositions(data) {
  return request({
    url: '/api/positions/query',
    method: 'post',
    data: data || {},
    headers: {
      'Content-Type': 'application/json'
    }
  })
}